﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using WebStudio.Business.Rule;

public partial class UserControl_ucMenu : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            loadData();
        }
    }

    private void loadData()
    {
        rptBind();
    }

    private void rptBind()
    {
        rptParent.DataSource = AlbumRule.GetParentAlbumlList(0);
        rptParent.DataBind();
    }

    protected void rptParent_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
        {
            HiddenField hfCId = (HiddenField)e.Item.FindControl("hfCId");
            Repeater rptSub = (Repeater)e.Item.FindControl("rptSub");
            int cid = Convert.ToInt32(hfCId.Value);
            rptSub.DataSource = AlbumRule.GetParentAlbumlList(cid);
            rptSub.DataBind();
        }
    }
}
